package org.spring.aicloud.mapper;

import org.apache.ibatis.annotations.Select;
import org.spring.aicloud.entity.Comment;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.spring.aicloud.entity.vo.CommentVO;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author lei
 * @since 2024-07-10
 */
public interface CommentMapper extends BaseMapper<Comment> {

    @Select("SELECT c.*,u.username FROM `comment` c left join `user` u on u.uid=c.uid " +
            "where c.did=#{did} order by c.cid desc")
    List<CommentVO> getCommentList(@RequestParam("did") Long did);

}
